﻿#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using Microsoft.ApplicationBlocks.Data;
using MCMLXVII.BackEnd.Data.OrganizationChart.DataSets;

#endregion

namespace MCMLXVII.BackEnd.Data.OrganizationChart
{
    public class TreeLists
    {
        public TreeLists()
        {

        }
        public static DSOrganizationMembersClasses.OrganizationMembersClassesDataTable GetOrganizationMembersClasses(int MemberID)
        {
            DSOrganizationMembersClasses.OrganizationMembersClassesDataTable dt = new DSOrganizationMembersClasses.OrganizationMembersClassesDataTable();
            dt.Load(SqlHelper.ExecuteReader("GetOrganizationMembersClasses", new object[] { MemberID }));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }

        public static DSOrganizationTreeMemberInfo.MemberOfDataTable GetOrganizationTreeGroups(string FindPattern)
        {
            DSOrganizationTreeMemberInfo.MemberOfDataTable dt = new DSOrganizationTreeMemberInfo.MemberOfDataTable();
            dt.Load(SqlHelper.ExecuteReader("GetOrganizationGroups", FindPattern));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }

        public static DSOrganizationTreeMemberInfo.MemberOfDataTable GetOrganizationTreeMembers(int ClassID, string FindPattern)
        {
            DSOrganizationTreeMemberInfo.MemberOfDataTable dt = new DSOrganizationTreeMemberInfo.MemberOfDataTable();
            dt.Load(SqlHelper.ExecuteReader("GetOrganizationMembers", ClassID, FindPattern));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }
    
        public static DSOrganizationTreeMemberInfo.MemberOfDataTable GetOrganizationTreeRoleMembers(int ClassID, string FindPattern)
        {
            DSOrganizationTreeMemberInfo.MemberOfDataTable dt = new DSOrganizationTreeMemberInfo.MemberOfDataTable();
            dt.Load(SqlHelper.ExecuteReader("GetOrganizationRoleMembers", ClassID, FindPattern));
            if (dt.Rows.Count > 0)
                return dt;
            else
                return null;
        }


        public static DSOrganizationTreeMemberInfo.MemberOfRow GetOrganizationTreeMemberDesc(int MemberID)
        {
            DSOrganizationTreeMemberInfo.MemberOfDataTable dt = new DSOrganizationTreeMemberInfo.MemberOfDataTable();
            dt.Load(SqlHelper.ExecuteReader("GetOrganizationMemberDesc", MemberID));
            if (dt.Rows.Count > 0)
                return (DSOrganizationTreeMemberInfo.MemberOfRow)dt.Rows[0];
            else
                return null;
        }


    }
}
